<?php
declare(strict_types=1);

namespace App\Controller\Api\V1;

use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\Di\Annotation\Inject;
use HyperfExt\Auth\Contracts\AuthManagerInterface;
use Hyperf\HttpServer\Annotation\Middleware;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\RequestMapping;
use App\Middleware\ApiTokenAuthMiddleware;

/**
 * class ApiTokenController
 * @package App\Controller\Api\V1
 *  @Middleware(ApiTokenAuthMiddleware::class)
 * @Controller(prefix="/api/v1/sys")
 */
class ApiTokenController extends CController
{

    /**
     * @Inject()
     * @var AuthManagerInterface
     */
    private $authManager;
    /**
     *
     *
     * @RequestMapping(path="callback", methods="post")
     */
    public function callback(RequestInterface $request)
    {
        $params = $request->all();


        $user = $this->authManager->guard()->user();
        info('zz');
        return $user;

        $fd = data_get($params, 'client_id', '');
        try {
            $res = $this->sender->disconnect((int)$fd);
        } catch (\Exception $e) {
            throw new \LogicException('消息转发失败', 1005);
        }
        return $res;
    }
}
